# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-1
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "1"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-1
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "1"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "1"
        - name: ZOOKEEPER_SERVER_1
          value: kafka-zoo-svc-1
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false
    
# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-2
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "2"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-2
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "2"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "2"
        - name: ZOOKEEPER_SERVER_2
          value: kafka-zoo-svc-2
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false


# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-3
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "3"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-3
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "3"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "3"
        - name: ZOOKEEPER_SERVER_3
          value: kafka-zoo-svc-3
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false

# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-4
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "4"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-4
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "4"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "4"
        - name: ZOOKEEPER_SERVER_4
          value: kafka-zoo-svc-4
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false


# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-5
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "5"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-5
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "5"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "5"
        - name: ZOOKEEPER_SERVER_5
          value: kafka-zoo-svc-5
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false



# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-6
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "6"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-6
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "6"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "6"
        - name: ZOOKEEPER_SERVER_6
          value: kafka-zoo-svc-6
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false



# svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc-7
  namespace: spark-cluster
spec:
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    zkserver: "7"

# rc
---
apiVersion: v1
kind: ReplicationController
metadata:
  name: kafka-zoo-7
  namespace: spark-cluster
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: kafka
        component: kafka-zoo
        zkserver: "7"
    spec:
      containers:
      - name: zoo
        image: index.tenxcloud.com/zhangshun/zookeeper:3.4.9
        ports:
        - containerPort: 2181
        - containerPort: 22
        env:
        - name: ZOOKEEPER_ID
          value: "7"
        - name: ZOOKEEPER_SERVER_7
          value: kafka-zoo-svc-7
        volumeMounts:
        - mountPath: /opt/zookeeper-3.4.9/data
          name: glusterfsvol
        resources:
          requests:
            cpu: 100m
      volumes:
        - name: glusterfsvol
          glusterfs:
            endpoints: glusterfs-cluster
            path: {{ gluster_rta_zoo_volname }}
            readOnly: false



# total svc
---
apiVersion: v1
kind: Service
metadata:
  name: kafka-zoo-svc
  namespace: spark-cluster
spec:
  type: NodePort
  ports:
  - name: client
    port: 2181
    protocol: TCP
  - name: follower
    port: 2888
    protocol: TCP
  - name: leader
    port: 3888
    protocol: TCP
  - name: ssh
    port: 22
    protocol: TCP
  selector:
    app: kafka
    component: kafka-zoo
